﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DIS.Infrastructure.Entities.Repository;
using DIS.Infrastructure.Entities.Enum;
using DIS.Infrastructure.Entities.Cache;
using DIS.Infrastructure.Entities.DTO;

namespace DIS.Infrastructure.Entities.Entity
{
    public class LongHaulDetail:IAccessible<T_LongHaulDetail, LongHaulDetail>, ILogicEntity<T_LongHaulDetail, LongHaulDetail>
    {
         
        public int Id { get; set; }

        public int LongHaulId { get; set; }
 
        public string LongHaulDescription { get; set; }

        public int Days { get; set; }

        public decimal TotalFee { get; set; }

        public int InvoiceCount { get; set; }

        public decimal AllowanceMoney { get; set; }

        public int tempId { get; set; }

        public List<LongHaulDTO> dtoList { get; set; }

        public LongHaul longHaul { get; set; }

        public LongHaulDetail LoadLongFee(T_LongHaul longHaul)
        {
            this.longHaul = new LongHaul().Set(longHaul);
            return this;
        }
        public LongHaulDetail LoadLongFee(T_LongHaul longHaul, T_User user)
        {
            this.longHaul = new LongHaul().Set(longHaul).LoadUser(user);
            return this;
        }

        protected override void Covariant(T_LongHaulDetail model)
        {
            this.Id = model.Id;
            this.LongHaulId = model.LongHaulId;
            this.LongHaulDescription = model.LongHaulDescription;
            this.Days = model.Days;
            this.TotalFee = model.TotalFee;
            this.InvoiceCount = model.InvoiceCount;
            this.AllowanceMoney = model.AllowanceMoney;
            
        }
        protected override T_LongHaulDetail Inverter(LongHaulDetail model)
        {
            return new T_LongHaulDetail()
            {
                Id = model.Id,
                LongHaulId = model.LongHaulId,
                LongHaulDescription = model.LongHaulDescription,
                Days = model.Days,
                TotalFee = model.TotalFee,
                InvoiceCount = model.InvoiceCount,
                AllowanceMoney=model.AllowanceMoney
            };
        }
        public LongHaulDetail Set(T_LongHaulDetail dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
